package com.example.lightcontrol;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;

public class ConfigureActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_configure);
        final EditText ipaddressEdit = findViewById(R.id.ipAddress);
        final EditText portEdit = findViewById(R.id.port);
        //final EditText lightNameEdit = findViewById(R.id.lightName);


        Button btn = findViewById(R.id.btn);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(ConfigureActivity.this,MainActivity.class);
                 String ipaddress = ipaddressEdit.getText().toString();
                 String port = portEdit.getText().toString();
                 //String lightName = lightNameEdit.getText().toString();
                intent.putExtra("ipaddress",ipaddress);
                intent.putExtra("port",port);
                //intent.putExtra("lightName",lightName);
                startActivity(intent);
                finish();
            }
        });

    }
}
